#include <bits/stdc++.h>
using namespace std;
const int maxn = 52;
int N;
bool G[maxn][maxn];
int c[maxn];

inline int id(char a, char b){
    return (a-'A')*2 + (b=='-'? 1:0);
}

void con(char a1, char a2, char b1, char b2){
    if(a1 == '0' || b1 == '0') return;
    int u = id(a1, a2)^1, v = id(b1, b2);
    G[u][v] = true;
}

bool bfs(int u){
    c[u] = -1;
    for (int v = 0; v < maxn; ++v) {
        if(G[u][v]){
            if(c[v]<0) return true;
            else if(!c[v] && bfs(v)) return true;
        }
    }
    c[u] = 1;
    return false;
}

int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    while(cin >> N && N){
        memset(G, false, sizeof(G));
        memset(c, 0, sizeof(c));
        for (int i = 0; i < N; ++i) {
            string in; cin >> in;
            for (int k = 0; k < 4; ++k) {
                for (int l = 0; l < 4; ++l) if(k!=l){
                    con(in[k*2], in[k*2+1], in[l*2], in[l*2+1]);
                }
            }
        }
        bool ok = false;
        for (int j = 0; j < maxn; ++j)
            if(!c[j])
                if(bfs(j)) {ok = true; break;}
        if(ok) cout << "unbounded\n";
        else cout << "bounded\n";
    }
    return 0;
}